package com.xit.hitmouse.dao;

import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

/**
 * @author 厦工 友敏612
 * @Date 2023/11/23
 */
public class GameDB {
    public static final String DB_NAME="GameDB";
    public static final int VERSION = 1;
    private static GameDB gameDB;
    private SQLiteDatabase db;

    private GameDB(Context context){
        DBHelper dbHlper = new DBHelper(context,DB_NAME,null,VERSION);

        db = dbHlper.getWritableDatabase();
    }

    public  synchronized  static GameDB getInstance(Context context){
        if(gameDB==null){
            gameDB = new GameDB(context);
        }
        return gameDB;
    }
    public void saveKill(Integer count,Integer run ,Integer userid,String time){

            ContentValues values = new ContentValues();
            values.put("count", count);
            values.put("run",  run);
            values.put("userid",userid);
            values.put("time",time);
            db.insert("kill", null, values);
    }


    public void saveUser(String username ,String password){

        ContentValues values = new ContentValues();
        values.put("username", username);
        values.put("password", password);

        db.insert("user", null, values);
    }
}
